﻿<?php  
//$lstrFilename = $_REQUEST["filename"];
//$lstrFilepath = $_REQUEST["filepath"];
//$lstrFilename = urlencode($lstrFilename);

$lstrFilepath = "files/下载 +示例图片.JPG";
$lstrFilepath = iconv("utf-8", "gbk", $lstrFilepath);

$lstrFilename = "下载 +示例图片.JPG";
$lstrFilename = iconv("utf-8", "gbk", $lstrFilename);
if(file_exists($lstrFilepath)){
	echo "文件已存在！";
	Header('Content-Description: File Transfer');
	Header('Content-Type: application/octet-stream; charset=UTF-8');
	//Header('Content-Disposition: attachment; filename="'.$lstrFilename.'"; charset=UTF-8');
	Header('Content-Disposition: attachment; filename="'.$lstrFilename.'"; charset=gbk');
	Header('Content-Transfer-Encoding: binary');
	Header('Expires: 0');
	Header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
	Header('Pragma: public');
	Header('Content-Length: ' . filesize($lstrFilepath));
	ob_clean();
	flush();
	readfile($lstrFilepath);
  exit;
}else 
{
	echo "<script type='text/javascript' >";
	echo "window.close();";
	echo "</script>";
}